<?php
/**
 * Created by HTD
 * QQ:387938921
 * TEL:18868809048
 * on 2017/6/29 10:41.
 */


namespace backend\modules\payment\controllers;


use backend\models\activeRecords\TPay;
use common\libs\Constants;
use yii\helpers\Json;
use yii\web\Controller;

class PayToGameController extends Controller
{
    public function actionFirstPayToGame()
    {
        $model = new TPay();
        return $this->render('first-pay-to-game',['model'=>$model]);
    }

    public function actionPay()
    {
        $model = new TPay();
        $params = \Yii::$app->request->bodyParams;
        if($params){
            $model->pay_game_id = $params['game_id'];
            $model->pay_server_id = $params['server_id'];
            $model->pay_game_user = $params['username'];
            $model->pay_money = 1;
            $result = $model->payToGame($model);
            echo $result;
        }
    }

}